home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / QuickTime VR / MacOS / QuickDraw™ 3D 1.0.6F4 SDK / Development / Interfaces / QD3DStorage.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-14  |  6.4 KB  |  234 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        QD3DStorage.h                                             **
  4.  **                                                                          **
  5.  **                                                                          **
  6.  **     Purpose:     Abstraction to deal with various types of stream-based     **
  7.  **                    storage devices.                                         **
  8.  **                                                                          **
  9.  **                                                                          **
  10.  **     Copyright (C) 1992-1995 Apple Computer, Inc.  All rights reserved.     **
  11.  **                                                                          **
  12.  *****************************************************************************/
  13. #ifndef QD3DStorage_h
  14. #define QD3DStorage_h
  15.  
  16. #ifndef QD3D_h
  17. #include <QD3D.h>
  18. #endif  /*  QD3D_h  */
  19.  
  20. #if PRAGMA_ONCE
  21.     #pragma once
  22. #endif
  23.  
  24. #if defined(__MWERKS__)
  25.     #pragma enumsalwaysint on
  26.     #pragma align_array_members off
  27.     #pragma options align=native
  28. #endif
  29.  
  30. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  31. #include <Types.h>
  32. #include <Files.h>
  33. #endif  /*  OS_MACINTOSH  */
  34.  
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif    /* __cplusplus */
  38.  
  39. /******************************************************************************
  40.  **                                                                             **
  41.  **                                Storage Routines                             **
  42.  **                                                                             **
  43.  *****************************************************************************/
  44.  
  45. TQ3ObjectType Q3Storage_GetType(
  46.     TQ3StorageObject    storage);
  47.  
  48. TQ3Status Q3Storage_GetSize(
  49.     TQ3StorageObject    storage,
  50.     unsigned long        *size);
  51.  
  52. /* 
  53.  *    Reads "dataSize" bytes starting at offset in storage, copying into data. 
  54.  *    sizeRead returns the number of bytes filled in. 
  55.  *    
  56.  *    You may assume if *sizeRead < dataSize, then EOF is at offset + *sizeRead
  57.  */
  58.  
  59. TQ3Status Q3Storage_GetData(
  60.     TQ3StorageObject    storage,
  61.     unsigned long        offset,
  62.     unsigned long        dataSize,
  63.     unsigned char        *data,
  64.     unsigned long        *sizeRead);
  65.  
  66. /* 
  67.  *    Write "dataSize" bytes starting at offset in storage, copying from data. 
  68.  *    sizeWritten returns the number of bytes filled in. 
  69.  *    
  70.  *    You may assume if *sizeRead < dataSize, then EOF is at offset + *sizeWritten
  71.  */
  72.  
  73. TQ3Status Q3Storage_SetData(
  74.     TQ3StorageObject    storage,
  75.     unsigned long        offset,
  76.     unsigned long        dataSize,
  77.     const unsigned char    *data,
  78.     unsigned long        *sizeWritten);
  79.  
  80. /******************************************************************************
  81.  **                                                                             **
  82.  **                             Memory Storage Prototypes                         **
  83.  **                                                                             **
  84.  *****************************************************************************/
  85.  
  86. QD3D_EXPORT TQ3ObjectType Q3MemoryStorage_GetType(
  87.     TQ3StorageObject        storage);
  88.  
  89. /*
  90.  * These calls COPY the buffer into QD3D space
  91.  */
  92. QD3D_EXPORT TQ3StorageObject Q3MemoryStorage_New(
  93.     const unsigned char        *buffer,
  94.     unsigned long            validSize);
  95.  
  96. QD3D_EXPORT TQ3Status Q3MemoryStorage_Set(
  97.      TQ3StorageObject        storage,
  98.     const unsigned char        *buffer,
  99.     unsigned long            validSize);
  100.  
  101. /*
  102.  * These calls use the pointer given - you must dispose it when you're through
  103.  */
  104. QD3D_EXPORT TQ3StorageObject Q3MemoryStorage_NewBuffer(
  105.     unsigned char            *buffer,
  106.     unsigned long            validSize,
  107.     unsigned long            bufferSize);
  108.  
  109. QD3D_EXPORT TQ3Status Q3MemoryStorage_SetBuffer(
  110.      TQ3StorageObject        storage,
  111.     unsigned char            *buffer,
  112.     unsigned long            validSize,
  113.     unsigned long            bufferSize);
  114.  
  115. QD3D_EXPORT TQ3Status Q3MemoryStorage_GetBuffer(
  116.      TQ3StorageObject        storage,
  117.     unsigned char            **buffer,
  118.     unsigned long            *validSize,
  119.     unsigned long            *bufferSize);
  120.  
  121. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  122.  
  123. /******************************************************************************
  124.  **                                                                             **
  125.  **                                Macintosh Handles Prototypes                 **
  126.  **                                                                             **
  127.  *****************************************************************************/
  128.  
  129. /* Handle Storage is a subclass of Memory Storage */
  130.  
  131. QD3D_EXPORT TQ3StorageObject Q3HandleStorage_New(
  132.     Handle                    handle,
  133.     unsigned long            validSize);
  134.  
  135. QD3D_EXPORT TQ3Status Q3HandleStorage_Set(
  136.      TQ3StorageObject        storage,
  137.     Handle                    handle,
  138.     unsigned long            validSize);
  139.  
  140. QD3D_EXPORT TQ3Status Q3HandleStorage_Get(
  141.      TQ3StorageObject        storage,
  142.      Handle                    *handle,
  143.     unsigned long            *validSize);
  144.  
  145. /******************************************************************************
  146.  **                                                                             **
  147.  **                                Macintosh Storage Prototypes                 **
  148.  **                                                                             **
  149.  *****************************************************************************/
  150.  
  151. QD3D_EXPORT TQ3StorageObject Q3MacintoshStorage_New(                    
  152.     short                    fsRefNum);    /* Note: This storage is assumed open */
  153.  
  154. QD3D_EXPORT TQ3Status Q3MacintoshStorage_Set(
  155.      TQ3StorageObject        storage,
  156.     short                    fsRefNum);
  157.  
  158. QD3D_EXPORT TQ3Status Q3MacintoshStorage_Get(
  159.      TQ3StorageObject        storage,
  160.     short                    *fsRefNum);
  161.     
  162. QD3D_EXPORT TQ3ObjectType Q3MacintoshStorage_GetType(
  163.     TQ3StorageObject        storage);
  164.  
  165.  
  166. /******************************************************************************
  167.  **                                                                             **
  168.  **                            Macintosh FSSpec Storage Prototypes                 **
  169.  **                                                                             **
  170.  *****************************************************************************/
  171.  
  172. QD3D_EXPORT TQ3StorageObject Q3FSSpecStorage_New(
  173.     const FSSpec            *fs);
  174.  
  175. QD3D_EXPORT TQ3Status Q3FSSpecStorage_Set(
  176.      TQ3StorageObject        storage,
  177.     const FSSpec            *fs);
  178.  
  179. QD3D_EXPORT TQ3Status Q3FSSpecStorage_Get(
  180.      TQ3StorageObject        storage,
  181.     FSSpec                    *fs);
  182.  
  183. #endif  /*  OS_MACINTOSH  */
  184.  
  185.  
  186. /******************************************************************************
  187.  **                                                                             **
  188.  **                                    Unix Prototypes                             **
  189.  **                                                                             **
  190.  *****************************************************************************/
  191.  
  192. TQ3StorageObject Q3UnixStorage_New(
  193.     FILE                    *storage);
  194.  
  195. TQ3Status Q3UnixStorage_Set(
  196.      TQ3StorageObject        storage,
  197.     FILE                    *stdFile);
  198.  
  199. TQ3Status Q3UnixStorage_Get(
  200.      TQ3StorageObject        storage,
  201.     FILE                    **stdFile);
  202.     
  203. TQ3ObjectType Q3UnixStorage_GetType(
  204.     TQ3StorageObject        storage);
  205.  
  206.  
  207. /******************************************************************************
  208.  **                                                                             **
  209.  **                                Unix Path Prototypes                         **
  210.  **                                                                             **
  211.  *****************************************************************************/
  212.  
  213. TQ3StorageObject Q3UnixPathStorage_New(                    
  214.     const char                *pathName);                /* C string */
  215.  
  216. TQ3Status Q3UnixPathStorage_Set(            
  217.      TQ3StorageObject        storage,
  218.     const char                *pathName);                /* C string */
  219.  
  220. TQ3Status Q3UnixPathStorage_Get(            
  221.      TQ3StorageObject        storage,
  222.     char                    *pathName);                /* pathName is a buffer */
  223.  
  224. #ifdef __cplusplus
  225. }
  226. #endif    /* __cplusplus */
  227.  
  228. #if defined(__MWERKS__)
  229. #pragma options align=reset
  230. #pragma enumsalwaysint reset
  231. #endif
  232.  
  233. #endif /* QD3DStorage_h */
  234.